CURRENT_FILES=$(wildcard *.cpp)

MY_PUBLIC_DIR=/home/gonghuan/search/public
MY_PUBLIC_FILE=$(wildcard /home/gonghuan/search/public/*.cpp)

PTHREAD_LIB=-lpthread

FILES=$(CURRENT_FILES) $(MY_PUBLIC_FILE)

ALL_INCL=-I. -I$(MY_PUBLIC_DIR)

LIBS=$(PTHREAD_LIB)

OPR=-g -Wall
CC=g++
CFLAGS=$(OPR)
OBJ=$(FILES:.cpp=.o)

TARGET=a.out

ALL:$(OBJ)
	rm -rf $(TARGET)
	$(CC) -o $(TARGET) $? $(LIBS)

$(OBJ):%.o:%.cpp
	$(CC) $(ALL_INCL) -c $(CFLAGS) $< -o $@

.PHONY:
clean:
	-rm -rf ./$(TARGET) $(MY_PUBLIC_DIR)/*.o ./*.o

